lead
Sink your streams.
Usage
var { Readable, Transform } = require('streamx');
var sink = require('lead');
var maybeThrough = new Transform({
transform(chunk, cb) {
cb(null, chunk);
},
});
Readable.from(['hello', 'world'])
.pipe(sink(maybeThrough));
API
sink(stream)
Takes a stream
to sink and returns the same stream. Sets up event listeners to infer if the stream is being used as a Transform
or Writeable
stream and sinks it on nextTick
if necessary. If the stream is being used as a Transform
stream but becomes unpiped, it will be sunk. Respects pipe
, on('data')
and on('readable')
handlers.
License
MIT